<include file="Public:header" />
<link type="text/css" href="__PUBLIC__/css/dynamic.css" rel="stylesheet"/>
<div class="container">
	<!-- Docs nav ================================================== -->
	<div class="page-header">
		<h4>{:L('USER_VIEW')}</h4>
	</div>
	<div class="row">
		<div class="span12">
			<include file="Public:alert" />
			<ul class="nav nav-tabs">
				<li class="active"><a href="#tab1" data-toggle="tab">{:L('BASIC_INFO')}</a></li>
				<li><a href="#tab2" data-toggle="tab">{:L('USER_INFO_NOTE')}({$user['log_count']})</a></li>
				<li><a href="#tab3" data-toggle="tab">{:L('RELATED_ATTACHMENT')}({$user['file_count']})</a></li>
			</ul>
			<div class="tab-content">
				<div class="tab-pane active" id="tab1">
					<table class="table" width="95%" border="0" cellspacing="1" cellpadding="0">
						<thead>
							<tr> 
								<td <if condition="C('ismobile') eq 1">colspan="2"<else />colspan="4"</if>>
									<p style="font-size: 14px;">
										<a href="javascript:void(0);" class="add_log">{:L('ADD_USER_INFO_NOTE')}</a> | 
										<a href="javascript:void(0);" class="add_file">{:L('ADD_FILE')}</a> |
										<a href="{:U('user/edit','id=' . $user['user_id'])}">{:L('EDIT')}</a> | 
										<a href="javascript:void(0)" onclick="javascript:history.go(-1)">{:L('RETURN')}</a>
									</p>
								</td>
							</tr>
						</thead>
						<tbody>
							<tr>
								<th <if condition="C('ismobile') eq 1">colspan="2"<else />colspan="4"</if>>{:L('BASIC_INFO')}</th>
							</tr>
							<tr>
								<td class="tdleft">{:L('USER_LOGO')}</td>
								<td colspan="3"><if condition="$user['img'] neq ''"><img src="{$user.img}" class="thumbnail img"/><else/>
									<img src="__PUBLIC__/img/avatar_default.png" class="thumbnail img"/>
									</if>
								</td>
							</tr>
							<tr>
								<td class="tdleft" width="15%">{:L('USER_NAME')}:</td><td width="35%">{$user.user_name}(<volist name="categoryList" id="temp"><if condition="$temp.category_id eq $user['category_id']">{$temp.name}</if></volist>)</b></td>
								<if condition="C('ismobile') eq 1"></tr><tr></if>
								<td  class="tdleft" width="15%">{:L('CURRENT_POSITION')}</td><td width="35%">{$user['department_name']}-{$user['role_name']}</td>
							</tr>
							<tr>
								<td class="tdleft">{:L('SEX')}:</td>
								<td><if condition="$user['sex'] eq 1">{:L('MALE')}<elseif condition="$user['sex'] eq 2"/>{:L('FEMALE')}<elseif condition="$user['sex'] eq 0"/>{:L('UNKNOW')}</if></td>
								<if condition="C('ismobile') eq 1"></tr><tr></if>
								<td class="tdleft">{:L('EMAIL')}:</td>
								<td><a href="mailto:{$user.email}">{$user.email}</a></td>
							</tr>
							<tr>
								<td class="tdleft">{:L('TELPHONE')}:</td><td><a href="tel:{$user.telephone}">{$user.telephone}</a></td>
								<if condition="C('ismobile') eq 1"></tr><tr></if>
								<td class="tdleft">{:L('AUDIT_STATUS')}:</td>
								<td><if condition="$user['status'] eq 0">{:L('UNAUDITED')}</if><if condition="$user['status'] eq 1">{:L('PASS')} </if>
								</td>
							</tr>
							<tr>
								<td class="tdleft">{:L('ADDRESS')} :</td>
								<td <if condition="C('ismobile') neq 1">colspan="3"</if>>{$user.address}</td>
							</tr>
						</tbody>
					</table>
				</div>
				<div class="tab-pane" id="tab2">
					<table class="table">
						<if condition="$user.log eq null">
							<tr>
								<td>{:L('EMPTY_DATA')} </td>
							</tr>
						<else /> 
							<tr>
								<td>&nbsp;</td>
								<td>{:L('TITLE')}</td>
								<td>{:L('CONTENT')}</td>
								<td>{:L('CREATOR_ROLE')}</td>
								<td>{:L('CREATE_TIME')}</td>
							</tr>
							<volist name="user.log" id="vo">
								<tr>
									<td><a href="{:U('log/log_delete','id=' . $vo['log_id'] . '&r=RLogProduct')}">{:L('DELETE')}</a> &nbsp;<a href="{:U('log/view','id=' . $vo['log_id'])}" class="edit_log">{:L('VIEW')}</a></td>
									<td>
										{$vo.subject}
									</td>
									<td>
										<if condition="$vo.content neq null">{$vo.content|substr=0,60}……</if>
									</td>
									<td>
										<notempty name="vo.owner.user_name">{$vo.owner.user_name} [{$vo.owner.department_name}-{$vo.owner.role_name}]</notempty>
									</td>
									<td>
										<notempty name="vo.create_date">{$vo.create_date|date="Y-m-d  g:i:s a",###}</notempty>
									</td>
								</tr>
							</volist>
						</if>
						<tr>
							<td colspan="5">
								<a href="javascript:void(0);" class="add_log">{:L('ADD')}</a>
							</td>
						</tr>
					</table>
				</div>
				<div class="tab-pane" id="tab3">
					<table class="table">
						<if condition="$user.file eq null">
							<tr>
								<td>{:L('EMPTY_DATA')} </td>
							</tr>
						<else /> 
							<tr>
								<td>&nbsp;</td>
								<td>{:L('FILE_NAME')}</td>
								<td>{:L('SIZE')}</td>
								<td>{:L('ADD_TIME')}</td>
								<td>{:L('ADDED_BY')}</td>
							</tr>
							<volist name="user.file" id="vo">
								<tr>
									<td><a href="{:U('file/delete','id=' . $vo['file_id'])}">{:L('DELETE')}</a></td>
									<td>
										<a target="_blank" href="{$vo.file_path}">{$vo.name}</a>
									</td>
									<td>
										{$vo.size}{:L('BYTE')}
									</td>
									<td>
										<notempty name="vo.create_date">{$vo.create_date|date="Y-m-d g:i:s a",###}</notempty>
									</td>
									<td>
										<notempty name="vo.owner.user_name">{$vo.owner.user_name} [{$vo.owner.department_name}-{$vo.owner.role_name}]</notempty>
									</td>
								</tr>
							</volist>
						</if>
						<tr>
							<td colspan="5">
								<a href="javascript:void(0);" class="add_file">{:L('ADD')}</a>
							</td>
						</tr>
					</table>
				</div>
			</div>
		</div>
	</div>
</div>
<div class="hide" id="dialog-file" title="{:L('DIALOG_ADD_ATTACHMENTS')}">loading...</div>
<div class="hide" id="dialog-log" title="{:L('DIALOG_ADD_LOG')}">loading...</div>
<script type="text/javascript">
<if condition="C('ismobile') eq 1">width=$('.container').width() * 0.9;<else/>width=800;</if>
$("#dialog-file").dialog({
    autoOpen: false,
    modal: true,
	width: width,
	maxHeigh: 400,
	position: ["center",100]
});
$("#dialog-log").dialog({
    autoOpen: false,
    modal: true,
	width: width,
	maxHeigh: 400,
	position: ["center",100]
});
$(".add_file").click(function(){
	$('#dialog-file').dialog('open');
	$('#dialog-file').load('{:U("file/add","r=RFileUser&module=user&id=" . $user["user_id"])}');
});
$(".add_log").click(function(){
	$('#dialog-log').dialog('open');
	$('#dialog-log').load('{:U("log/add","r=RLogUser&module=user&id=" . $user["user_id"])}');
});
</script>
<include file="Public:footer" />	